package com.boot01.dao;

import com.boot01.pojo.Department;
import org.springframework.stereotype.Repository;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

/**
 * 部门DAO
 */
@Repository
public class DepartmentDao {

    private static final Map<Integer, Department> departmentMap;

    static {
        departmentMap = new HashMap<>();
        departmentMap.put(101, new Department(101,"市场部"));
        departmentMap.put(102, new Department(102,"运营部"));
        departmentMap.put(103, new Department(103,"后勤部"));
        departmentMap.put(104, new Department(104,"财务部"));
        departmentMap.put(105, new Department(105,"人事部"));
    }

    public Collection<Department> getDepartments(){
        return departmentMap.values();
    }

    public Department getDepartmentById(Integer id){
        return departmentMap.get(id);
    }
}
